import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import {guid} from '@/utils/guid';
import {get, post} from '@/utils/request';
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import WpcomUI from "wpcom-ui"
import "wpcom-ui/lib/style/index.css"
import '@/assets/css/created.css';
import '@/assets/css/main.less';
import animated from 'animate.css'

Vue.use(WpcomUI)
Vue.use(animated)

const {ipcRenderer} = window.require('electron');

Vue.config.productionTip = false;
Vue.prototype.$guid = guid;
Vue.prototype.$get = get;
Vue.prototype.$post = post;
Vue.prototype.Global = {};
Vue.prototype.eventBus = new Vue();
Vue.use(ElementUI, {size: 'small'});
if (process.env.NODE_ENV !== 'development') {
    console.log = function (message) {
        ipcRenderer.send('save-log', {
            type: 'info',
            message: message
        })
    }
    console.warn = function (message) {
        ipcRenderer.send('save-log', {
            type: 'warn',
            message: message
        })
    }
    console.error = function (message) {
        ipcRenderer.send('save-log', {
            type: 'error',
            message: message
        })
    }
}

let vm = new Vue({
    router,
    store,
    render: h => h(App)
})

ipcRenderer.send('electron-store:get')
ipcRenderer.once('electron-store:get', (event, data) => {
    window.appSettings = data
    vm.$mount("#app");
})
